package ds.factcom.controller.payment;
import java.util.Observer;

import javax.swing.table.TableModel;

import ds.factcom.controller.client.IClientController;
import ds.factcom.domain.client.Client;
import ds.factcom.exception.ClientHasNotInvoices;
import ds.factcom.exception.ClientHasNotInvoicesPending;
import ds.factcom.exception.ExistDomainException;
import ds.factcom.exception.NotExistDomainException;
import ds.factcom.model.PaymentModel;

/**
 * 
 * @author Javier De Luca, Maximiliano Herrera, Matias Samblancat
 * 
 */
public class PaymentController implements IClientController{
	
	private final PaymentModel paymentModel;

	public PaymentController(PaymentModel paymentModel) {
		this.paymentModel=paymentModel;	
	}

	public PaymentModel getPaymentModel() {
		return paymentModel;
	}

	public void generatePayment() throws ExistDomainException {
		this.paymentModel.generatePayment();
	}

	public void findClientByDocument(String documentType, String documentNumber) throws NotExistDomainException, ClientHasNotInvoices, ClientHasNotInvoicesPending {
		this.paymentModel.findClientByDocument(documentType, documentNumber);
	}

	public Float getMount() {
		return this.paymentModel.getMount();
	}

	public void addObserver(Observer observer) {
		this.paymentModel.addObserver(observer);
	}

	public void findByDocument(String documentType, String documentNumber) throws NotExistDomainException {
		paymentModel.findByDocument(documentType, documentNumber);
	}

	public Client getClient() {
		return paymentModel.getClient();
	}

	public int getNumberOfInvoicesPending() throws NotExistDomainException, ClientHasNotInvoices, ClientHasNotInvoicesPending {
		return paymentModel.getNumberOfInvoicesPending();
	}

	public int getPaymentNumber() {
		return paymentModel.getPaymentNumber();
	}

	public TableModel getItemTableModel(){
		return this.paymentModel.getItemTableModel();
	}

	public void cleanPayment() {
		paymentModel.cleanPayment();
	}

}
